<?php

// 获取项目评估报告历史记录
// GET project.cpHistory

namespace app\api\resource\project;
use think\Db;

class CpHistory
{
    // 方法
    public $_method = ['GET'];
    // 前置
    public $_pre    = ['login','isCyz'];
    // 描述
    public $_description = '获取项目评估报告历史记录';
    // 参数
    public $_param  = [
        'project_id' => '项目主键',
    ];
    // 返回
    public $_return = [
        200 => '获取成功',
        422 => '项目主键必须',
    ];

    public function run(&$request)
    {
        $project_id = $request->get('project_id/d',0);

        if (0 == $project_id) return [422,'项目主键必须'];

        $list = Db::name('project_cp_history')->where('project_id',$project_id)->order('id DESC')->select();

        return [200,$list];
    }
}